package com.game.business.service.impl;

import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
        import com.game.common.utils.DateUtils;
import com.game.system.service.ISysUserService;
import com.game.system.service.impl.SysUserServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.game.business.mapper.TOrderNoticeMapper;
import com.game.business.domain.TOrderNotice;
import com.game.business.service.ITOrderNoticeService;

/**
 * 订单消息Service业务层处理
 *
 * @author ruoyi
 * @date 2025-10-18
 */
@Service
public class TOrderNoticeServiceImpl extends ServiceImpl<TOrderNoticeMapper,TOrderNotice>  implements ITOrderNoticeService
{
    @Autowired
    private TOrderNoticeMapper tOrderNoticeMapper;

    @Autowired
    private ISysUserService sysUserService;

    /**
     * 查询订单消息
     *
     * @param id 订单消息主键
     * @return 订单消息
     */
    @Override
    public TOrderNotice selectTOrderNoticeById(String id)
    {
        return tOrderNoticeMapper.selectTOrderNoticeById(id);
    }

    /**
     * 查询订单消息列表
     *
     * @param tOrderNotice 订单消息
     * @return 订单消息
     */
    @Override
    public List<TOrderNotice> selectTOrderNoticeList(TOrderNotice tOrderNotice)
    {
        List<TOrderNotice> tOrderNotices = tOrderNoticeMapper.selectTOrderNoticeList(tOrderNotice);
        for (int i = 0; i < tOrderNotices.size(); i++) {
            tOrderNotices.get(i).setSendUser(sysUserService.selectUserById(Long.valueOf(tOrderNotices.get(i).getSendUserId())));
        }
        return tOrderNotices;
    }

    /**
     * 新增订单消息
     *
     * @param tOrderNotice 订单消息
     * @return 结果
     */
    @Override
    public int insertTOrderNotice(TOrderNotice tOrderNotice)
    {
                tOrderNotice.setCreateTime(DateUtils.getNowDate());
            return tOrderNoticeMapper.insertTOrderNotice(tOrderNotice);
    }

    /**
     * 修改订单消息
     *
     * @param tOrderNotice 订单消息
     * @return 结果
     */
    @Override
    public int updateTOrderNotice(TOrderNotice tOrderNotice)
    {
                tOrderNotice.setUpdateTime(DateUtils.getNowDate());
        return tOrderNoticeMapper.updateTOrderNotice(tOrderNotice);
    }

    /**
     * 批量删除订单消息
     *
     * @param ids 需要删除的订单消息主键
     * @return 结果
     */
    @Override
    public int deleteTOrderNoticeByIds(String[] ids)
    {
        return tOrderNoticeMapper.deleteTOrderNoticeByIds(ids);
    }

    /**
     * 删除订单消息信息
     *
     * @param id 订单消息主键
     * @return 结果
     */
    @Override
    public int deleteTOrderNoticeById(String id)
    {
        return tOrderNoticeMapper.deleteTOrderNoticeById(id);
    }
}
